﻿namespace KinonekoSoftware.CodariaDB.Documents.DataParts.Basics
{

    public enum CustomizedInformationType
    {
        Text,
        Toggle,
        Numeric,
    }

    [Obsolete("即将使用新的系统替代现有的基础信息模组")]
    public sealed class CustomizedInformation : RootObject
    {
        private string _name;
        private string _value;
        private string _Metadata;

        public string Metadata
        {
            get => _Metadata;
            set => SetValue(ref _Metadata, value);
        }

        public string Value
        {
            get => _value;
            set
            {
                SetValue(ref _value, value);
                OnValueChanged?.Invoke(_value);
            }
        }

        /// <summary>
        /// 类型
        /// </summary>
        public CustomizedInformationType Type { get; init; }

        public string Name
        {
            get => _name;
            set => SetValue(ref _name, value);
        }


        [BsonIgnore]
        public bool IsRemovable { get; init; }

        [BsonIgnore]
        public Action<string> OnValueChanged { get; set; }
    }
}